#include "Input.h"

namespace GeorgeLib
{

	Input::Input()
	{
		for (int i = 0; i < KEYS_MAX; ++i)
		{
			keys[i] = false;
			if (i < SPECIAL_MAX) special[i] = false;
			if (i < MOUSE_MAX) mouse[i] = false;
		}
	}

	void Input::KeyboardFunc(uchar key, int x, int y)
	{
		keys[key] = true;
	}

	void Input::KeyboardUpFunc(uchar key, int x, int y)
	{
		keys[key] = false;
	}

	void Input::SpecialFunc(int key, int x, int y)
	{
		if (key > 0xC) key -= 0x57;
		special[key] = true;
	}

	void Input::SpecialUpFunc(int key, int x, int y)
	{
		if (key > 0xC) key -= 0x57;
		special[key] = false;
	}

	void Input::MouseFunc(int button, int state, int x, int y)
	{
		mouse[button] = !(bool)state;
		mousePos(x, y);
	}

	void Input::MotionFunc(int x, int y)
	{
		mousePos(x, y);
	}

	void Input::PassiveMotionFunc(int x, int y)
	{
		mousePos(x, y);
	}

} // namespace GeorgeLib